package com.chen.springbootswagger.controller;

import com.chen.springbootswagger.entity.User;
import com.chen.springbootswagger.utils.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(value = "用户管理", description = "用户操作 API")
public class UserController {

    @ApiOperation(value = "添加用户", notes = "根据参数创建用户")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "用户ID", required = true, dataType="Long", paramType = "query"),
            @ApiImplicitParam(name = "name", value = "用户名称", required = true, dataType="String", paramType = "query"),
            @ApiImplicitParam(name = "sex", value = "用户性别", required = false, dataType="String", paramType = "query")})
    @PostMapping(value = "message")
    public BaseResult<User> create(User user) {
        return new BaseResult<>(0,"ok",new User());
    }
}
